define(function () {

    var self,
        app = win.app,
        pageParameters,
        userInfo,
        addressInfo = {//客户
            GWBNID: '',// 客户编号
            GWAKL004: '',//客户名称
            GWAK028: '',// 区域县
            GWAK030: '',//电话
        },
        subData = {
            GWBN002: '',//拜访日期
            GWBN005: '1',//维系方式
            GWBN006: '',//拜访人员姓名
            GWBN007: '',//拜访人员职位
            GWBN008: '',//拜访人员角色
            GWBN009: '',//拜访地址
            GWBN010: '',//拜访目的
            GWBN011: '',//拜访内容
            GWBN012: '',//商机评定审核说明（主管回复）
            GWBN013: '',
            GWBN014: '',//备注
        },
        g_GWBN013 = []//领导批示
    ;

    app.newModule({

        init: function () {
            self = this;
            self._super({
                _readyBefore: function () {
                    userInfo = app.userInfos.sysUser;
                    pageParameters = self._pageParameters;
                    app.extend2({target: subData, res: pageParameters.item});
                    app.extendUpLow({target: addressInfo, res: pageParameters.item, extend: false});
                    if (subData.GWBN013 && subData.GWBN013.indexOf('[') != -1) {
                        g_GWBN013.pushArray(JSON.parse(data.GWBN013));
                    }
                }
            }, win);
        },
        _ready: function () {
            new Vue({
                el: app.getByid(doc, 'mui-scroll'),
                data: {
                    sub: subData,
                    address: addressInfo,
                    GWBN013s: g_GWBN013,
                    orgid: userInfo.ORG_ID
                },
                methods: {
                    submitData: function () {
                        app.ajax({
                            xurl: "api/wx/bfjlsp/updateInfo",
                            xdata: {
                                GWBNID:subData.GWBNID,
                                GWBNSEQ:subData.GWBNSEQ,
                                GWBN012:subData.GWBN012
                            },
                            loading: true,
                            rules: {
                                GWBN012: {
                                    nul: [false, '请输入主管回复']
                                }
                            },
                            confirm: {
                                msg: '是否提交资料？'
                            },
                            cb: function (result) {
                                if (result.ok) {
                                    pageParameters.item.GWBN012 = subData.GWBN012;
                                    app.back(1);
                                }
                            }
                        });
                    }
                }
            });
        },
        _lazy: function () {
            this._super();

            mui('.mui-scroll-wrapper').scroll({
                deceleration: 0.0005
            });
        }
    });

});